<template>
  <uni-card :title="detail.title" :sub-title="detail.username">
    <view>
      {{detail.content}}
    </view>
    <view style="text-align: right; font-size: 0.7em; font-weight: bold;" slot="actions">
      {{ tools.formatDate(detail.lastupdate) }}
    </view>
  </uni-card>

</template>

<script setup>
  import {
    onLoad
  } from '@dcloudio/uni-app'

  onLoad((event) => {
    console.log('加载信息：', event)
    bid.value = event.bid
    query()
  })

  import {
    ref
  } from 'vue'
  import {
    api,
    tools
  } from '../../js/api.js'

  const bid = ref(-1)
  const detail = ref({})

  const query = () => {
    api.get(`/crud/billboard/${bid.value}`, {}, (data) => {
      if (data.success) {
        detail.value = data.data
        return
      }
      uni.showToast({
        title: data.message,
        icon: 'fail'
      })
    })
  }
</script>

<style>

</style>